home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / doom / axxwar_1.zip / SOURCES / FLARES.QC < prev    next >
Text File  |  1997-03-05  |  4KB  |  163 lines

  1. void() spike_touch;
  2. void() superspike_touch;
  3. void(vector org, vector vel, float damage) SpawnBlood;
  4. void(float damage) spawn_touchblood;
  5.  
  6. // AXXFL START
  7.  
  8. void() flare_touch;
  9. void() flare_bright;
  10. void() flare_dim;
  11.  
  12. /*
  13. ================================
  14. launch_flare
  15.  
  16. rework of id's launch_spike code
  17. ================================
  18. */
  19. void(vector org, vector dir) launch_flare =
  20. {
  21.     local   entity  missile;
  22.  
  23.     missile = spawn ();
  24.     missile.owner = self;
  25.     missile.movetype = MOVETYPE_FLYMISSILE;
  26.     missile.solid = SOLID_BBOX;
  27.  
  28.     missile.angles = vectoangles(dir);
  29.     
  30. // go to flare_touch if the flare touches anything
  31.     missile.touch = flare_touch;
  32.         missile.classname = "flare";
  33.  
  34. // go to flare_bright when the flare's think time is up
  35.     missile.think = flare_bright;
  36.  
  37. // 3 seconds until flare goes bright
  38.     missile.nextthink = time + 3;
  39.  
  40. // The LASER.MDL makes a decent flare
  41.     setmodel (missile, "progs/laser.mdl");
  42.     setsize (missile, VEC_ORIGIN, VEC_ORIGIN);               
  43.     setorigin (missile, org);
  44.     missile.velocity = dir * 1000;
  45.  
  46. // Make the flare dim. (.effects is an 8-bit register)
  47.         missile.effects=EF_DIMLIGHT;
  48.  
  49. };
  50.  
  51. /*
  52. ============================
  53. flare_touch
  54.  
  55. rework of id's spike_touch()
  56. ============================
  57. */
  58. void() flare_touch =
  59. {
  60. local float rand;
  61.     if (other == self.owner)
  62.         return;
  63.  
  64.         if (other.classname == "door" || other.classname == "plat")
  65.                 {
  66.                 remove(self);
  67.                 return;
  68.                 }
  69.  
  70.     if (other.solid == SOLID_TRIGGER)
  71.         return; // trigger field, do nothing
  72.  
  73.     if (pointcontents(self.origin) == CONTENT_SKY)
  74.     {
  75.         remove(self);
  76.         return;
  77.     }
  78.     
  79. // has the flare hit something that bleeds?
  80.     if (other.takedamage)
  81.     {
  82.                 // If so, spawn some blood
  83.         spawn_touchblood (9);
  84.                 // also do one point of damage    
  85.         T_Damage (other, self, self.owner, 1);
  86.  
  87. /*
  88. Don't remove the flare unless it is still flying. Otherwise, monsters or
  89. other players can come up and 'pull' your flare out of the wall
  90. */
  91.           if (self.velocity != '0 0 0')
  92.             remove(self);
  93.     }
  94.     else
  95.     {
  96.         // Write information to the network
  97.         WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  98.         WriteByte (MSG_BROADCAST, TE_SPIKE);
  99.         WriteCoord (MSG_BROADCAST, self.origin_x);
  100.         WriteCoord (MSG_BROADCAST, self.origin_y);
  101.         WriteCoord (MSG_BROADCAST, self.origin_z);
  102.     }
  103.  
  104. //Stop the flare, but do not remove it.
  105.     self.movetype = MOVETYPE_NONE;
  106. // Fix it so that flare only partially embeds itself (thanks, Luke)
  107.         self.origin = self.origin - self.velocity * 0.005;
  108.          self.velocity = '0 0 0';
  109.     self.touch = SUB_Null;
  110. };
  111.  
  112.  
  113. /*
  114. ==============================
  115. flare_bright()
  116.  
  117. This function makes the flare
  118. emit brighter light
  119. ==============================
  120. */
  121.  
  122. void() flare_bright =
  123. {
  124.     local vector    vel;
  125. // Make the flare get BRIGHT by setting .effects bit       
  126.         self.effects=EF_BRIGHTLIGHT;
  127. // Give it 10 seconds at maximum intensity
  128.     self.nextthink = time + 10;
  129. // After 10 seconds, call flare_dim
  130.     self.think = flare_dim;
  131. // Play a sound for flare ignition
  132.     sound (self, CHAN_WEAPON, "misc/power.wav", 1, ATTN_NORM);
  133.     
  134. // Set up some red and yellow sparks
  135.     vel = '0 0 150';
  136.     particle (self.origin+vel*0.01,vel,111,150);
  137.         vel = '0 0 120';
  138.     particle (self.origin+vel*0.01,vel,73,200);
  139.  
  140.  
  141.  
  142. /*
  143. ==============================
  144. flare_dim()
  145.  
  146. This function makes the flare
  147. go dim again
  148. ==============================
  149. */
  150. };
  151.  
  152. void() flare_dim =
  153. {
  154. // Make the flare get dim by setting .effects bit        
  155.         self.effects=EF_DIMLIGHT;
  156. // Give it 15 seconds before burnout
  157.     self.nextthink = time + 15;
  158. // After 15 seconds remove the flare from the game
  159.     self.think = SUB_Remove;
  160. };
  161.  
  162. // AXXFL END
  163.